import { apiGet, withAuth } from "@/lib/api/client";

export interface PersonaSummary {
  id: string;
  name: string;
  displayName: string;
  description?: string | null;
  avatar?: string | null;
  voiceId?: string | null;
  language: string;
  skills: string[];
  createdAt: string; // Beijing ISO from backend
  updatedAt: string; // Beijing ISO from backend
}

export interface PersonaDetail extends PersonaSummary {
  systemPrompt: string;
  isActive: boolean;
  isPublic: boolean;
  creatorId?: string | null;
}

export async function getPersonas(signal?: AbortSignal) {
  return apiGet<PersonaSummary[]>("/personas", withAuth({ signal }));
}

export async function getPersona(id: string, signal?: AbortSignal) {
  return apiGet<PersonaDetail>(`/personas/${id}`, withAuth({ signal }));
}